/**
年度再培训的明细页面
*/
<template>

  <div class="app-container">
    <p>1111111111111</p>
    <!-- Note that row-key is necessary to get a correct row order. -->
    培训编号：<input

      v-model="id"
      type="text"
      readonly="readonly"
    >
    培训主题：<input

      v-model="subject"
      type="text"
      readonly="readonly"
    >
    <div> <button
      id="btnModify"
      type="button"
      class="btn btn-default btn-clean"
      @click="handleEdit()"
    >提交</button></div>
  </div>
</template>

<script>

// arr to obj, such as { CN : "China", US : "USA" }

import { editTrainReList, editTrainRe } from '@/api/train-re'

export default {

  name: 'TrainReDetail',
  data() {
    return {
      id: null,
      obj: null,
      subject: null
    }
  },
  created() {
    this.id = this.$route.query.id
    this.fechData()
  },
  methods: {

    fechData() {
      console.log(this.id)
      editTrainReList(this.id).then(response => {
        this.editList = response
        this.obj = response
        this.id = response.id
        this.subject = response.subject
        console.log('wo' + response)
      })
    },
    handleEdit() {
      const query = { id: this.id, subject: this.subject }
      editTrainRe(query).then(response => {
        this.obj = response
        this.id = response.id
        this.subject = response.subject
        console.log('修改后' + response)
        alert('修改成功')
      })
      // 刷新页面
      location.reload()
    }
  }
}

</script>

<style>
.sortable-ghost{
  opacity: .8;
  color: #fff!important;
  background: #42b983!important;
}
</style>

<style scoped>
.icon-star{
  margin-right:2px;
}
.drag-handler{
  width: 20px;
  height: 20px;
  cursor: pointer;
}
.show-d{
  margin-top: 15px;
}
</style>
